#include <windows.h>
#include <wchar.h>
#include <stdio.h>
#include "io.h"
#include "fcntl.h"
#include "math.h"



// ----------------------------------------------------------------------------
// CreateConsole -- Create a console for debugging
// ----------------------------------------------------------------------------
void CreateConsole()
{
	// create a new console to the process
	AllocConsole();

	int hCrun = _open_osfhandle((intptr_t)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
	FILE *file = _fdopen(hCrun, "w");
	
	// use default stream buffer
	setvbuf(file, NULL, _IONBF, 0);
	*stdout = *file; 
	printf("This window is just in charge of outputting. \n");
	printf("Please quit from the main windows, otherwise it could cause memeory problems!\n");
}